import 'package:flutter/material.dart';
import 'package:landlore/customWidget/recordBody.dart';
import 'package:landlore/model/orderVO.dart';
import 'package:landlore/screens/recordDetailFullScreen.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

/***
 * 账本详情页面
 */
class RecordDetailScreen extends StatelessWidget {
  final OrderVO orderOV;

  const RecordDetailScreen({super.key, required this.orderOV});

  @override
  Widget build(BuildContext context) {
    return MediaQuery(
      ///设置文字大小不随系统设置改变
      data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: const Color(0xffe9c46a),
          leading: IconButton(
            icon: Icon(
              Icons.arrow_back_ios,
              color: Colors.black,
              size: 35.sp,
            ),
            onPressed: () => Navigator.pop(context),
          ),
          // title: Text(
          //   "${orderOV.createDate!.year}.${orderOV.createDate!.month}月",
          //   style: TextStyle(decoration: TextDecoration.none, fontSize: 30,color: Colors.black),
          // ),
          centerTitle: true,
          actions: [
            Container(
              padding: EdgeInsets.only(right: 10.w, bottom: 10.h, top: 5.h),
              child: ElevatedButton(
                  onPressed: () {
                    Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) =>
                                RecordDetailFullScreen(orderOV: orderOV)));
                  },
                  style: ButtonStyle(
                      elevation: MaterialStateProperty.all(5),
                      backgroundColor:
                          MaterialStateProperty.all(const Color(0xfff4a261))),
                  child: Text(
                    '查看全部',
                    style: TextStyle(
                        color: Colors.black87,
                        fontSize: 18.sp,
                        fontWeight: FontWeight.w900),
                  )),
            )
          ],
        ),
        body: Container(
            color: Colors.grey,
            child: ListView(
              children: [RecordBody(orderVO: orderOV, forceChangeState: false,)],
            )),
      ),
    );
  }
}
